package HelloServiceDo

import (
	"github.com/Shopify/sarama"
	KafkaTest "goGrpc/helloService/Kafka"
	"log"
)

func KafaProduceHello() {
	topic := KafkaTest.KafkaConfigs.KafkaTopic
	msgX := &sarama.ProducerMessage{
		Topic: topic,
		Value: sarama.StringEncoder("Hello kafka"),
	}
	partition, offset, err := KafkaTest.KafkaProducer.SendMessage(msgX)
	if err != nil {
		log.Printf("Kafa生产者发送消息异常:%s \n", err)
	}
	log.Printf("Kafa生产者发送消息成功:, 消息具体信息：topic(%s)/partition(%d)/offset(%d) \n", topic, partition, offset)
}
